home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MYMUD21.ZIP / MMUD21.ZIP / SOURCE / SOURCE.ZIP / MYIO.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-21  |  2KB  |  134 lines

  1. {$I COPYRGHT.INC}
  2.  
  3. (*----------------------------------------------------------------------------*
  4.  
  5.    I/O interface to simplify implementation of modem/network code
  6.  
  7.  *---------------------------------------------------------------------------*)
  8.  
  9.  
  10. Unit MyIO;
  11. Interface
  12. Uses CRT;
  13.  
  14. Procedure My_ReadLn(Var S : String);
  15. Function  My_KeyPressed:Boolean;
  16. Function  My_ReadKey:Char;
  17. Procedure My_Write(S : String);
  18. Procedure My_WriteLn(S : String);
  19. Procedure My_ClrEol;
  20. Procedure My_Delay(D : LongInt);
  21. Procedure My_ClrScr;
  22. Procedure My_gotoXy(X,Y : Byte);
  23. Function  My_WhereX:Byte;
  24. Function  My_WhereY:Byte;
  25. Procedure My_Window(x1,y1,x2,y2 : Byte);
  26.  
  27. Function My_YesNo(Txt : String;Default : Char):Char;
  28. Procedure My_WaitForKey(Txt : String);
  29. Procedure My_Beep;
  30.  
  31. Implementation
  32.  
  33. Procedure My_ReadLn(Var S : String);
  34. Begin
  35. ReadLn(S);
  36. End;
  37.  
  38. Function My_KeyPressed:Boolean;
  39. Begin
  40. My_KeyPressed:=CRT.KeyPressed;
  41. End;
  42.  
  43. Function My_ReadKey:Char;
  44. Begin
  45. My_ReadKey:=CRT.ReadKey;
  46. End;
  47.  
  48. Procedure My_Write(S : String);
  49. Begin
  50. Write(S);
  51. End;
  52.  
  53. Procedure My_WriteLn(S : String);
  54. Begin
  55. WriteLn(S);
  56. End;
  57.  
  58. Procedure My_ClrEol;
  59. Begin
  60. CRT.ClrEol;
  61. End;
  62.  
  63. Procedure My_ClrScr;
  64. Begin
  65. CRT.ClrScr;
  66. End;
  67.  
  68. Procedure My_gotoXy(X,Y : Byte);
  69. Begin
  70. CRT.GotoXy(X,Y);
  71. End;
  72.  
  73. Function  My_WhereX:Byte;
  74. Begin
  75. My_WhereX:=CRT.WhereX;
  76. End;
  77.  
  78. Function  My_WhereY:Byte;
  79. Begin
  80. My_WhereY:=CRT.WhereY;
  81. End;
  82.  
  83. Procedure My_Delay(D : LongInt);
  84. Begin
  85. CRT.Delay(D);
  86. End;
  87.  
  88. Procedure My_Window(x1,y1,x2,y2 : Byte);
  89. Begin
  90. CRT.Window(X1,Y1,X2,Y2);
  91. End;
  92.  
  93.  
  94.  
  95. Function My_YesNo(Txt : String;Default : Char):Char;
  96. Var Key : Char;
  97. Begin
  98. If Upcase(Default)='Y'
  99.    Then My_write(Txt+' [Yn]: ')
  100.    Else My_Write(Txt+' [yN]: ');
  101. Repeat
  102.  Key:=Upcase(My_ReadKey);
  103. Until Key in['Y','N',#13];
  104. Case Key Of
  105.  #13 : My_YesNo:=Default;
  106.  Else  My_YesNo:=Key;
  107. End; {Case}
  108. End;
  109.  
  110. Procedure My_WaitForKey(Txt : String);
  111. Var Dum : Char;
  112. Begin
  113. My_WriteLn('');
  114. My_Write(Txt);
  115. Dum:=My_ReadKey;
  116. If Dum=#00
  117.    Then Dum:=My_ReadKey;
  118. End;
  119.  
  120. Procedure My_Beep;
  121. Begin
  122. CRT.NoSound;
  123. CRT.Sound(1000);
  124. CRT.Delay(100);
  125. CRT.NoSound;
  126. End;
  127.  
  128.  
  129.  
  130. Begin
  131. Assign(Output,'');
  132. Rewrite(Output);
  133. End.
  134.